home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre1.z / postgre1 / demo / wholedemo.sh < prev   
Encoding:
Linux/UNIX/POSIX Shell Script  |  1992-08-27  |  969 b   |  37 lines

  1. #!/bin/sh
  2.  
  3. # $Header: /private/postgres/demo/RCS/wholedemo.sh,v 1.3 1992/02/25 15:02:57 clarsen Exp $
  4. # This is a simple script used to run the entire demo without having to
  5. # type all of those tedious include commands to the terminal monitor.
  6. # This script assumes that the postmaster is currently running.
  7. # NOTE:
  8. # It also assumes that you don't have a data base demo in which you keep
  9. # important data (it destroys demo if it exists then re-creates it to run
  10. # the postgres demo queries).
  11.  
  12. datafile=/tmp/pgdemo.$$
  13.  
  14. if [ -d $POSTGRESHOME/data/base/demo ]
  15. then
  16.     echo =============== destroying old demo database... =================
  17.     $POSTGRESHOME/bin/destroydb demo
  18. fi
  19.  
  20. echo =============== creating new demo database... =================
  21. $POSTGRESHOME/bin/createdb demo
  22.  
  23. rm -f $datafile
  24.  
  25. echo "retrieve (x=1) \g" > $datafile
  26.  
  27. for f in `cat demo_order`
  28. do
  29.     cat $POSTGRESHOME/demo/$f >> $datafile
  30. done
  31.  
  32.  
  33. $POSTGRESHOME/bin/monitor demo < $datafile
  34.  
  35. rm -f $datafile
  36.